<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
	<head>
		<base href="<%=basePath%>">
		<meta charset="utf-8" />
		<title>校园招聘</title>
		<link rel="stylesheet" href="css/bootstrap.min.css">
		<link href="css/content.css" rel="stylesheet">
		<link href="css/footer.css" rel="stylesheet">
		<script type="text/javascript" src="js/jquery-3.4.1.js"></script>
		<script type="text/javascript" src="js/bootstrap.min.js"></script>

	</head>
	<body>
		<!-- 导入导航栏 -->
		<jsp:include page="/common/header.jsp"></jsp:include>
		<!-- 分割 -->
		<div style="height: 20px;"></div>
		<!--内容-->
		<div class="big_czmm_content">
			<div class="czmm_content">
				
				<form action="person/reset" class="nr" method="post"  enctype="multipart/form-data" onsubmit="return check()" >
					<center><font align="center" style="color:red;font-size:15px;">${sessionScope.setflag}</font></center>
					<c:remove var="setflag"/>
					<div class="nr_01">
						<div class="text">旧密码</div>
						<input type="password" class="input_00 input_01" onblur="oldcheck(this.value)"/><span  ><font id="oldtip"></font></span>
					</div>
					<div class="nr_01">
						<div class="text">新密码</div>
						<input type="password" class="input_00 input_01" onblur="newcheck(this.value)"/><span ><font id="newtip"></font></span>
					</div>
					<div class="nr_01">
						<div class="text">确认新密码</div>
						<input type="password" name="password" class="input_00 input_01" onblur="new2check(this.value)" /><span ><font id="new2tip"></font></span>
					</div>
					<input type="hidden" name="id" value="${user.id }">
					<div class="nr_02">
						<input type="submit" value="确认修改" class="input_11">
					</div>
				</form>
			</div>
		</div>

		<!-- 导入底部信息 -->
		<jsp:include page="/common/footer.jsp"></jsp:include>
		
		<script type="text/javascript">
			var t1=t2=t3=t4=0;
			var newpa;
		
			function oldcheck(t){
			 	if(t==${user.password}){
			 		t1=1;
			 		document.getElementById('oldtip').innerText = "";
			 	}else if(t==""){
			 		t1=0;
			 		document.getElementById('oldtip').innerText = "旧密码不能为空";
			 	}else{
			 		t1=0
			 		document.getElementById('oldtip').innerText = "旧密码错误";
			 	}
			
			
			}
			function newcheck(t){
				newpa=t;
				if (t.match(/^[a-z0-9_-]{6,18}$/)) {
					if(t==${user.password}){
						t2=0;
						document.getElementById('newtip').innerText = "新密码不能和旧密码相同";
					}else{
						t2=1;
						document.getElementById('newtip').innerText = "";
					}
				} else {
						t2=0;
					document.getElementById('newtip').innerText = "密码不能少于6位";
				}
			}
			function new2check(t){
				if(t==newpa){
					t3=1;
			 		document.getElementById('new2tip').innerText = "";
			 	}else{
			 		t3=0;
			 		document.getElementById('new2tip').innerText = "两次密码输入须一致";
			 	}
			}
			function check(){
				if(t1==1 && t2==1 && t3==1){
					return true;
				}else{
					alert("请确保信息填写正确");
					return false;
				
				}
			
			
			
			}
		
		
		
		
		</script>
	</body>
</html>
